/**
 *
 */
package com.itboye.mengwu.data.repository;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.mengwu.data.interfaces.IUserRepositoryto;
import com.itboye.mengwu.data.model.PersonDataBean;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
//import com.itboye.core.utils.HttpUtils;

/**
 * @author hebidu
 *
 */
public class UserRepositoryto extends BaseNetRepository implements
        IUserRepositoryto<PersonDataBean> {

    public static String LoginByPwd = "BY_User_login";// 用户登陆（正常登录）

    String api="100";
    public UserRepositoryto() {

    }

    public UserRepositoryto(ICompleteListener listener) {
        this.setListener(listener);
    }



	/*
	 * 登录
	 *
	 * @see
	 * com.itboye.mengwu.data.interfaces.IUserRepository#login(java.lang.Object)
	 * 2016-4-21 hebidu
	 */

    @Override
    public void login(PersonDataBean model) {

        String apiVer = api;
        Map<String, Object> params = new HashMap<String, Object>();

        if (model.getType() == 0) {// 账号密码登录
            params.put("uid", model.getUid());
            params.put("password", model.getLogin_session_code());

            // Builder<PersonDataBean> builder = new Builder<PersonDataBean>();

            // 目前最简化调用
            // START
            (new Builder<PersonDataBean>())
                    .setTypeVerParamsAndReturnClass(LoginByPwd, apiVer, params,
                            PersonDataBean.class)
                    .requestListener(
                            new BaseSuccessReqListener<PersonDataBean>(
                                    getListener()))
                    .errorListener(new BaseErrorListener(getListener()))
                    .desEncodeThenBuildAndSend();
        }

    }

    @Override
    public void add(PersonDataBean model) {

    }

    @Override
    public void delete(PersonDataBean model) {

    }

    @Override
    public void update(PersonDataBean model) {

    }

    @Override
    public void getInfo(PersonDataBean model) {

    }

    @Override
    public List<PersonDataBean> queryYouHuiQuan(PersonDataBean model) {
        return null;
    }
}
